<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.ufida.ebscg.comm.session.UserBean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招商银行供应商门户-采购创造价值-供应商自助_信息修改02</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/style_add.css" rel="stylesheet" type="text/css" />
<link href="css/selfcss.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
	@import url(css/select2css.css);
-->
</style>
<script type="text/javascript" src="js/select2css.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/caltimer.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/ajaxdeal.js"></script>
</head>

<body style="width:610px">

<div id="main">
<!--右侧内容开始-->
<div id="right">
  <table width="610" border="0" cellpadding="0" cellspacing="0" background="images/self_bjc_005.jpg" height="26">
    <tr>
      <td width="10" align="center">&nbsp;</td>
      <td width="85" align="center" class="f-14-818080"><a href="modifyperson.do?to=1">基本信息</a></td>
      <td width="83" align="center" class="f-14-818080"><a href="modifyperson.do?to=1&steptype=1">联系信息</a></td>
      <td width="83" align="center" class="f-14-818080"><a href="modifyperson.do?to=1&steptype=2">其他信息</a></td>
      <td width="85" align="center" class="f-14-818080"><a href="modifyperson.do?to=1&steptype=3">多联系人</a></td>
      <td width="85" align="center" class="f-14-2b5577">文档上传</td>
      <td>&nbsp;</td>
    </tr>
  </table><br/>
<form  action="modifyperson.do" name="fileupload" enctype="MULTIPART/FORM-DATA" method="post">
<input type="hidden" name="steptype" value="5"/>
<input type="hidden" name="zdy4" value="${message.zdy4}"/>
<div id="regright">
  <table width="600px">
    <tr>
      <td class="textright" align="right" width="600px"><img src="../images/botton_add.jpg" width="45" height="21" onclick = "addRow()"  style="cursor:hand" /></td>
    </tr>
  </table>
    
  <table cellspacing="0" class="regtable" >
    <tr class="thbgc">
      <th class="center" colspan='2' width="300px">文档名称</th>
      <th class="center" width="100px">上传时间</th>
      <th class ="center" width="200px">操作</th>
   </tr>
   
     <logic:iterate id="att" name = "atts">
	     <tr >
	      <td class="center"  width="200px">${att.filename }</td>
	      <td class="center" width="100px"></td>
	      <td class="center" width="100px">${att.upload_date }</td>
	      <td id="${att.pk_da_att}" class ="center" width="200px"><img src="../images/botton_delete.jpg" style='cursor:hand' border=0 onclick="deleteFileRecord('${att.pk_da_att}','${att.filename}')" style="border-width:0"/></td>
	   	</tr> 
     </logic:iterate>
  </table>
  
  <table cellspacing="0" class="regtable" id="fileuploadtable">
  
  </table>
  <table>
  <tr>
      <td colspan="5" class="f-12-F60000">说明：上传文档应为资质认证、供应产品信息等相关文档;<br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果在添加上传文件时无法选择文件，请先设置浏览器到兼容型视图，具体请见首页相关操作手册。</td>
    </tr>
    <tr>
      <td colspan="5" class="center"><img src="../images/botton_revision .jpg" width="60"  height="20" border="0"  onclick="toMainIndex()" style="cursor:hand"/></td>
    </tr>
  </table>
</div>
</form>

<script language="javascript">
var subBool = true;
var rowindex = 0;
//向批量上传文件的列表中添加一行数据
function addRow()
{
     var root = document.getElementById("fileuploadtable");
     var row = root.insertRow();
     
     row.style.height = '26px';
     rowindex++;
     row.id = "row"+rowindex;
     var cell1 = row.insertCell();
     
     cell1.align="center";
    
     cell1.width="200px";
     var cell2 = row.insertCell();
     
     cell2.align="center";

	 cell2.width="100px";
	 var innercontent = "  <input type='file' name='inputfile"+rowindex+"' id='file"+rowindex+"' style='position:absolute;opacity:0;filter:alpha(opacity=0); width:20px; height:20px' onchange='ondatachange(this,"+rowindex+")'  />  ";
     cell2.innerHTML = innercontent;
	 var cell3= row.insertCell();
     
     cell3.width="100px";
     cell3.align = "center";
     var d = new Date();
   	 cell3.innerText = d.getYear()+"-"+(parseInt(d.getMonth())+parseInt(1))+"-"+d.getDate();

     var cell4 = row.insertCell();
     
     cell4.width="200px";
     cell4.align="center";
     
     var img = "<img src='../images/botton_upload-.jpg' id='img"+rowindex+"' style='cursor:hand' border=0 style='cursor:hand'  onmouseover='showfiledialog("+rowindex+")'/>&nbsp<img src='../images/botton_delete.jpg' style='cursor:hand' border=0 style='cursor:hand' onclick='deleteRow("+rowindex+")'/>";
     cell4.innerHTML = img; 
}
/*
	当上传文件数据更改时使用
*/
function ondatachange(fileobject,index)
{
	if(fileobject.value != null && fileobject.value != "")
	{
		var fileType = fileobject.value.substring(fileobject.value.lastIndexOf(".")+1,fileobject.value.length);
		
		if(fileType == "zip" || fileType == "rar" || fileType == "7z"){
			var row = document.getElementById("row"+index);
			var cells = row.cells;
			var cell = cells[0];
			cell.innerHTML =  fileobject.value.substring(fileobject.value.lastIndexOf("\\")+1,fileobject.value.lastIndexOf("."));
			var img = document.getElementById("img"+index);
			img.style.visibility = "hidden";
			fileobject.style.display = "none";
	 	}else{
	 		showmess("请上传压缩文件,文件大小不能超过30M");
	 	}
		 
	}
}

//删除上传文件
function deleteRow(index)
{
	var root = document.getElementById("fileuploadtable");
	var row = "row"+index ;
	
	var rows = root.rows;
    var deletepos = 0;
    
    //寻找到对应的删除行并进行删除
	for(var pos = 0; pos < rows.length; pos++)
	{
		var temprow = rows[pos];
		if(temprow.id == row)
		{
			root.deleteRow(pos);
			deletepos = pos;
			rowindex--;
			break;
		}
	}
}

function toMainIndex()
{
	if(subBool){
		subBool = false;
		document.fileupload.submit();
	}
	/*else{
		alert('正在提交中，请等待！');
	}*/
}
function deleteFileRecord(pk_da_att,filename){
	deleteAttFile(pk_da_att+'lyan');
	//将要删除的文件进行添加进修改记录
	/*try{
		var url = "/portal/deletefile.do?type=record&attpk="+pk_da_att;
		alert(url);
		ajax(url,returnFunction);
	}catch(e){
		alert("保存删除的附件时出现了错误!");	
	}
	//删除附件后返回信息
	function returnFunction(data){
		if(data == "ok"){
			//删除点击到的附件
			deleteAttFile(pk_da_att);
		}else{
			alert("保存附件信息失败!");	
		}
	}*/
}
</script>
</body>
</html>
